<?php 
namespace Home\Model;
use Think\Model;
class UserModel extends Model{
	public function getAll(){

		$userlist = $this->select();
		//处理数据性别
		$sex = array('女','男');
		foreach ($userlist as $key => $val){
			$userlist[$key]['sex'] = $sex[$val['sex']];
		}

		$state = array('后台管理员','普通会员','商家');
		foreach($userlist as $key => $val){
			$userlist[$key]['state'] = $state[$val['state']];
		}

		foreach($userlist as $key => $val){
			date_default_timezone_set("PRC");  //设置中国时区
			$userlist[$key]['addtime'] = date('Y-m-d H:i:s',$userlist[$key]['addtime']);
		}

		return $userlist;
	}

	public function getInfo(){
		$info = $this->find();

		date_default_timezone_set("PRC");  //设置中国时区
		$info['addtime'] = date('Y-m-d H:i:s',$info['addtime']);

		return $info;
	}

}


 ?>